<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>打开辅助中</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
</head>
<body>
<div>
    <h1 id="msg">正在打开设置页......</h1>
</div>
<script>
    let xmlHttp = new XMLHttpRequest();
    let url = "http://127.0.0.1:17171";
    let msg = "无法连接到Java，请检查Java后台程序是否启动！！启动后刷新重试。"
    xmlHttp.open("GET", url + "/app/info", true);
    xmlHttp.timeout = 3000;
    xmlHttp.send();
    xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState === 4 && xmlHttp.status === 200) {
            let res = xmlHttp.response;
            if (res == null || res.length === 0) {
                showInfo();
            } else {
                window.open(url, "_self");
            }
        } else if (xmlHttp.readyState === 4 && xmlHttp.status !== 200) {
            showInfo();
        }
    }

    function showInfo() {
        document.getElementById("msg").innerText = msg;
        alert(msg);
    }
</script>
</body>
</html>